// 引入 connect 用于和 Ui 组件做关联
import { connect } from 'react-redux';

// 引入 Ui 组件
import CountUI from '../../components/Count';
import { createIncrement, createDecrement, createAsyncIncrement } from '../../redux/actions/count';

// 用于传递状态
function mapStateToProps(state,store) {
  return {
    count: state
  }
}
// 用于操作状态方法
function mapDispatchToProps(dispatch,store) {
  return {
    increment: (count) => dispatch(createIncrement(count)),
    decrement: (count) => dispatch(createDecrement(count)),
    asyncIncrement: (count, time) => dispatch(createAsyncIncrement(count, time)),
  }
}
// 连接
export default connect(mapStateToProps,mapDispatchToProps)(CountUI)